Ikonok
' . $catdir . ', as specified in the config, does not exist in this directory. The value of the variable $catdir must match the name of the created folder (case-sensitive), and that folder must be in this directory for the script to work. Create the folder and put the individual icon category folders inside it.';
exit();
}
$getfolders = opendir($catdir);
while (($file = readdir($getfolders)) !== false) {
if (($file != '.' && $file != '..') && (is_dir($catdir.'/'.$file))) {
$cats[] = $file;
}
}
if (!$cats) {
echo 'No category folders were found inside the folder named
' . $catdir . '. Create your individual category folders inside that folder and the menu will appear.';
exit();
}
natcasesort($cats);
// build main menu
if ((!$_GET['cat']) || (!in_array($_GET['cat'], $cats))) {
?>
Ide jöhet bemutatkozó szöveg, vagy bármi más is. Persze ez a rész sem kötelező és ki is törölhető a kódból, ha nem szeretnél az ikonokon kívül semmi mást megosztani a látogatóiddal.
Arra szeretnélek kérni, ha az Ikonbázis kódját tőlem viszed el, hogy a Powered by hivatkozást NE töröld ki a kódból! Az alap kód innen van, de ez a kód utoljára 2006-ban frissült, így már elavult a legújabb adatbázissal rendelkező tárhelyeken. Pár dolgot át írtam a kódban, hogy működőképes legyen a script. Plusz egy sima stílust is adtam hozzá, így már könnyebben fogod tudni a saját ízléseddé alakítani az egész ikonbázist. Magyarosítottam is benne minden szükséges részt.
A régi kód is használható természetesen, csak nem minden tárhelyen.
';
foreach ($cats as $value) {
$catname = str_replace('_', ' ', $value);
echo '
' . $catname . '';
if ($getcount) {
$icons = array();
$getcount = opendir($catdir . '/' . $value);
while (($icon = readdir($getcount)) !== false) {
if (preg_match ('~.jpg|.jpeg|.gif|.png|.bmp|~', $icon)) {
$icons[] = $value;
}
}
$count = count($icons);
if ($count == 1) {
echo ' (' . $count . ' ikon)';
} else {
echo ' (' . $count . ' ikon)';
}
}
echo '';
}
echo '';
}
// get icons and sort
if (in_array($_GET['cat'], $cats)) {
$icons = array();
$geticons = opendir($catdir.'/'.$_GET['cat']);
while (($icon = readdir($geticons)) !== false) {
if (preg_match ('~.jpg|.jpeg|.gif|.png|.bmp|~', $icon)) {
$icons[] = array("name" => $icon, "modified" => filemtime($catdir . '/' . $_GET['cat'] . '/' . $icon));
}
}
$count = count($icons);
if ($count > 0) {
function modcmp($a, $b) {
return strcmp($a['modified'], $b['modified']);
}
usort($icons, 'modcmp');
if ($sort == 'first') {
$icons = array_reverse($icons);
}
// configure pagination
if ((!$perpage) || ($perpage < 1) || (!is_numeric($perpage))) {
$perpage = 20;
}
$pagecalc = ($count / $perpage);
$pagecount = ceil($pagecalc);
$page = $_GET['page'];
if (($page > $pagecount) || ($page == '0')) {
$start = 0;
} elseif (!$page) {
$start = 0;
$page = 1;
} elseif (!is_numeric($page)) {
$start = 0;
$page = 1;
} else {
$start = (($page * $perpage) - $perpage);
}
$pagearray = array_slice($icons, $start, $perpage);
// if there is more than one page, show the page menu
if ($pagecount > 1) {
if (($page <= $pagecount) && ($page > 1)) {
$backpagecalc = ($page - 1);
$backpage = '
« ' . $divider;
}
if ($page < $pagecount) {
$nextpagecalc = ($page + 1);
$nextpage = $divider . '
»';
}
echo '';
}
// show the icons
echo '
';
foreach ($pagearray as $value) {
$iconsize = getimagesize($catdir . '/' . $_GET['cat'] . '/' . $value['name']);
echo ' ';
}
} else {
echo '
Ez a kategória nem tartalmaz ikonokat.';
}
echo '
« Vissza a főoldalra
';
}
?>
Powered by LindaDesign